'''
# Coding:utf-8
# Project: iiop
# Author: rtf
# Time: 2021-04-15 10:02:15
# FileName: random_str.py
# Software: PyCharm
'''

import random
import string


def generate_random_str(random_length=4):
    """
    生成一个指定长度的随机字符串
    """
    random_str = ''
    for i in range(random_length):
        random_str += random.choice(string.ascii_letters + string.digits)
    return random_str


print(generate_random_str())